<?php
namespace app\store\validate;
use think\Validate;

class User extends Validate
{
    protected $rule = [
        'name'     => 'require',
        'mobile'   => 'require|mobile|unique:user',
        'token'  => 'token'
    ];

    protected $message = [
        'name.require'     => '姓名不能为空',
        'mobile.require'   => '手机号码不能为空',
        'mobile.mobile'    => '手机号码格式错误',
        'mobile.unique'    => '手机号码已存在',
        'token.token'  => '网页失效,请刷新页面',
    ];

    /**
     * 验证场景
     * @var \string[][]
     */
    protected $scene = [
        'add'   =>  ['name','mobile','token'],
        'edit'  =>  ['name','mobile','token'],
    ];
}
